<?php
$this->breadcrumbs=array(
        'Administrar',
	'Questionário'=>array('admin/questionario/admin'),
        $questionario->nome=>array('admin/questao/admin','q'=>$questionario->id_questionario),
	'Gerenciar Alternativas',
);

$this->menu=array(
	array('label'=>'Nova Alternativa', 'url'=>array('create','id_questao'=>Yii::app()->request->getQuery('id_questao'))),
);
?>

<h1>Gerenciar Alternativas</h1>

<p>
    <strong>Questionário: </strong><?php echo $questionario->nome; ?> (Versão <?php echo number_format($questionario->versao, 1); ?>)<br />
    <strong>Questão: </strong><?php echo $questao->descricao_questao; ?><br />
</p>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'alternativa-grid',
	'dataProvider'=>$model->search(),
        'template'=>'{items}',
	'columns'=>array(
		array(
                    'name'=>'texto',
                    'value'=>'$data->texto',
                    'headerHtmlOptions'=>array('style'=>'width: 340px; height: 30px;'),
                    'htmlOptions'=>array('style'=>'text-align: left; height: 20px;'),
                ),
                array(
                    'name'=>'fator_multiplicativo',
                    'value'=>'number_format($data->fator_multiplicativo,2)',
                    'headerHtmlOptions'=>array('style'=>'width: 70px; height: 30px;'),
                    'htmlOptions'=>array('style'=>'text-align: center; height: 20px;'),
                ),
		array(
                    'class'=>'CButtonColumn',
                    'template'=>'{update}{delete}',
                    'buttons'=>array(
                        'update'=>array(
                            'url'=>'Yii::app()->createUrl("admin/alternativa/update",array("id_questao"=>$data->id_questao,"a"=>$data->id_alternativa))',
                        ),
                        'delete'=>array(
                            'url'=>'Yii::app()->createUrl("admin/alternativa/delete",array("id_questao"=>$data->id_questao,"a"=>$data->id_alternativa))',
                        ),
                    ),
		),
	),
)); ?>
